package com.seal.commons.validator.jsr303;

import com.seal.commons.enums.Currency;
import com.seal.commons.utils.StringUtils;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class CurrencyValidator implements
        ConstraintValidator<CurrencyName, String> {

	@Override
	public void initialize(CurrencyName value) {
	}

	@Override
	public boolean isValid(String value, ConstraintValidatorContext arg1) {
	    if(StringUtils.isBlank(value)){
            return true;
        }
	    
		return Currency.isCurrency(value);
	}
}
